<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="layout" content="main" />
<title>Search Results</title>
</head>
<body>
    <div class="body">
        <div class="nav" role="navigation">
            <ul>
                <li><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
            </ul>
        </div>

        <h1>Search Results:</h1>
        <g:if test="${flash.message}">
            <div class="message">
                ${flash.message}
            </div>
        </g:if>
        
        <table>
            
            <thead>
                <g:sortableColumn property="fromUser" title="From: " />  
                <g:sortableColumn property="toUser" title="To: " />
                <g:sortableColumn property="title" title="Title: " />
                <g:sortableColumn property="message" title="Message: " />
            </thead>
            
            <tbody>

                <g:each var="mail" status = "i" in="${userMail}">
                    <tr class="${(i % 2) == 0 ? 'even' : 'odd'}">
                    
                        <td><g:link controller="user" action="show" id="${mail.fromId}"> ${mail.fromUser} </g:link></td>
                        
                        <td><g:link controller="user" action="show" id="${mail.toId}"> ${mail.toUser} </g:link></td>
                        
                        <td><g:link controller="mail" action="show" id="${mail.id}"> ${mail.title} </g:link></td>
                        
                        <td> ${mail.message } </td>
                            
                    </tr>
                </g:each>

            </tbody>
        </table>

    </div>
</body>
</html>